nanopyx.core.transform.padding

1import numpy as np
2
3def pad_w_zeros_2d(img, height, width):
4    
5    padded_img = np.zeros((height, width), dtype=img.dtype)
6    img_h, img_w = img.shape
7    padded_img[(height-img_h)//2:(height-img_h)//2+img_h,(width-img_w)//2:(width-img_w)//2+img_w] = img
8    
9    return padded_img
def pad_w_zeros_2d(img, height, width):
 4def pad_w_zeros_2d(img, height, width):
 5    
 6    padded_img = np.zeros((height, width), dtype=img.dtype)
 7    img_h, img_w = img.shape
 8    padded_img[(height-img_h)//2:(height-img_h)//2+img_h,(width-img_w)//2:(width-img_w)//2+img_w] = img
 9    
10    return padded_img